#!/bin/bash


echo "Limpando diretorio"
rm ./disco/*
echo "Deletando DiscoURL "
rm ./DiscoURL.bin
echo "Criando novo pSaveDiskReadPos"
rm pSaveDiskReadPos
echo "0" >> pSaveDiskReadPos
echo "FIM..."


#Diretorio Base
BASE="./disco/"
#Declare array with 4 elements
ARRAY=( '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' 'a' 'b' 'c' 'd' 'e' 'f')
# get number of elements in the array
ELEMENTS=${#ARRAY[@]}

# echo each element in array 


#Cria diretorios
echo "Criando diretorios... 00 - ff"
for (( i=0;i<$ELEMENTS;i++)); do
	for (( j=0;j<$ELEMENTS;j++)); do
	    mkdir $BASE${ARRAY[${i}]}${ARRAY[${j}]}
	done
done

#limpa diretorios
echo "Limpando diretorios diretorios..."
for (( i=0;i<$ELEMENTS;i++)); do
	for (( j=0;j<$ELEMENTS;j++)); do
	    	echo "Apagando pasta: "$BASE${ARRAY[${i}]}${ARRAY[${j}]}
		for k in $BASE${ARRAY[${i}]}${ARRAY[${j}]}/*;
		do
			rm $k
		done
	done
done



